<?php
class Presensi_harian extends CI_Controller {

	function __construct()
	{
		parent::__construct();	
		$this->load->helper('flexigrid');
		$this->load->helper('format');
		$this->load->library('flexigrid');
		$this->load->library('form_validation');
		$this->load->model('master_model');
		// $this->load->model('siswa_model');
		$this->load->model('pelajaran_model');
		$this->load->model('presensi_model');
		$this->load->model('konfigurasi_model');
	}
	
	function index($act='')
	{
		$data['value_tingkat'] = '';
		$data['value_kelas'] = '';
		// $data['value_semester'] = '';
		// $data['tglpresensi'] = '';
		if($act == 'act_filter'){
			$data['value_tingkat'] = $this->input->post('tingkat');
			$data['value_kelas'] = $this->input->post('kelas');
			// $data['value_semester'] = $this->input->post('semester');
			// $data['tglpresensi'] = xFormatDate($this->input->post('tglpresensi'),'/','-');
			$this->session->set_userdata('sess_ph_tingkat', $this->input->post('tingkat'));
			$this->session->set_userdata('sess_ph_kelas', $this->input->post('kelas'));
			$this->session->set_userdata('sess_ph_semester', $this->input->post('semester'));
			// $this->session->set_userdata('sess_ph_tglpresensi', xFormatDate($this->input->post('tglpresensi'),'/','-'));
		}else{
			$data['value_tingkat'] = $this->session->userdata('sess_ph_tingkat');
			$data['value_kelas'] = $this->session->userdata('sess_ph_kelas');
			// $data['value_semester'] = $this->session->userdata('sess_ph_semester');
			// $data['tglpresensi'] = xFormatDate($this->input->post('sess_ph_tglpresensi'),'/','-');
		}
	
		/*
		 * 0 - display name
		 * 1 - width
		 * 2 - sortable
		 * 3 - align
		 * 4 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.)
		 */
		$colModel['no'] = array('No',40,TRUE,'center',0);
		if($this->session->userdata('roleid')=='0') //diknas
			$colModel['NAMA_SEKOLAH'] = array('Nama Sekolah',100,TRUE,'center',1);
		$colModel['TAHUN_AJARAN'] = array('Tahun Ajaran',100,TRUE,'center',1);
		$colModel['TINGKAT'] = array('Tingkat',100,TRUE,'center',1);
		$colModel['KELAS'] = array('Kelas',100,TRUE,'center',1);
		$colModel['SEMESTER'] = array('Semester',100,TRUE,'center',1);
		$colModel['TANGGAL'] = array('Tanggal',200,TRUE,'center',0);
		$colModel['aksi'] = array('Aksi',100,FALSE,'center',0);
		$colModel['Cetak'] = array('Cetak',100,FALSE,'center',0);
		
		/*
		 * Aditional Parameters
		 */
		$gridParams = array(
		'width' => 'auto',
		'height' => '345',
		'rp' => 10,
		'rpOptions' => '[10,15,20,25,40]',
		'pagestat' => 'Displaying: {from} to {to} of {total} items.',
		'blockOpacity' => 0.5,
		'title' => 'Daftar Presensi Siswa Harian'
		);
		
		/*
		 * 0 - display name
		 * 1 - bclass
		 * 2 - onpress
		 */
		
		if($data['value_tingkat']!=null and $data['value_tingkat']!=null)
			$buttons[] = array('Add','add','org_js');
		// $buttons[] = array('Delete','delete','org_js');
		$buttons[] = array('separator');
		$buttons[] = array('Select All','add','org_js');
		$buttons[] = array('Deselect All','delete','org_js');
		$buttons[] = array('separator');
		$buttons[] = array('Cetak Form Presensi','back','org_js');
		
		//Build js
		//View helpers/flexigrid_helper.php for more information about the params on this function
		$grid_js = build_grid_js('flex1',site_url("/presensi_harian/listpresensiharian_grid/".$this->session->userdata('unitid')."/".$data['value_tingkat']."/".$data['value_kelas']."/".$this->session->userdata('semester')),$colModel,'no','asc',$gridParams,$buttons);
		
		if($this->session->flashdata('suc_msg'))
			$data['header_info'] = '<div class="ret_success">'.$this->session->flashdata('suc_msg').'</div>';
		
		$data['title'] = "Contoh Flexigrid";
		$data['info'] = "Flexigrid";
		$data['js_grid'] = $grid_js;
		$data['version'] = "0.36";
		$data['download_file'] = "Flexigrid_CI_v0.36.rar";
		
		$data['added_js'] = 
			"<script type='text/javascript'>
			function org_js(com,grid)
			{
				if (com=='Select All')
				{
					$('.bDiv tbody tr',grid).addClass('trSelected');
				}
				
				if (com=='Deselect All')
				{
					$('.bDiv tbody tr',grid).removeClass('trSelected');
				}
				
				if (com=='Add')
				{
					 location.href='".base_url()."index.php/presensi_harian/input_presensiharian/".$this->session->userdata('unitid')."/".$data['value_tingkat']."/".$data['value_kelas']."/".$this->session->userdata('semester')."'; 
				}
				
				if (com=='Back to Pelajaran')
				{
					location.href='".base_url()."index.php/ms_pelajaran/'; 
				}
				
				if (com=='Cetak Form Presensi')
				{
					popup('".base_url()."index.php/presensi_harian/cetak_presensi/".$data['value_tingkat']."/".$data['value_kelas']."/".$this->session->userdata('semester')."/".date('Y-m-d')."/kosong',1050,600);
				}
				
				if (com=='Delete')
				{
				   if($('.trSelected',grid).length>0){
					   if(confirm('Anda yakin ingin menghapus ' + $('.trSelected',grid).length + ' buah data?')){
							var items = $('.trSelected',grid);
							var itemlist ='';
							for(i=0;i<items.length;i++){
								itemlist+= items[i].id.substr(3)+',';
							}
							$.ajax({
							   type: 'POST',
							   url: '".site_url('/presensi_harian/delete_presensiharian')."',
							   data: 'items='+itemlist,
							   success: function(data){
								$('#flex1').flexReload();
								alert(data);
							   }
							});
						}
					} else {
						return false;
					} 
				}          
			} 
			
			function popup(url,width,height) 
			{
				 var left   = (screen.width  - width)/2;
				 var top    = (screen.height - height)/2;
				 var params = 'width='+width+', height='+height;
				 params += ', top='+top+', left='+left;
				 params += ', directories=no';
				 params += ', location=no';
				 params += ', menubar=no';
				 params += ', resizable=no';
				 params += ', scrollbars=yes';
				 params += ', status=no';
				 params += ', toolbar=no';
				 newwin=window.open(url,'windowname5', params);
				 if (window.focus) {newwin.focus()}
				 return false;
			}
			
			function deleteabsen(idsekolah, ta, tingkat, kelas, smt, tgl){
				var del=confirm('Apakah Anda yakin akan menghapus Presensi Tanggal Tersebut ?');
				if(del){
					location.href='".base_url()."index.php/presensi_harian/delete_presensiharian/'+idsekolah+'/'+ta+'/'+tingkat+'/'+kelas+'/'+smt+'/'+tgl; 
				}
			}
			
			function go_cetak(id_sek, id_ta, id_tk, id_kls, id_smt, tgl, type){
				popup('".base_url()."index.php/presensi_harian/cetak_presensi/'+id_tk+'/'+id_kls+'/'+id_smt+'/'+type+'/'+tgl,1050,600);
			}
			</script>
			";
			
		$data['tingkat'] = $this->master_model->combo_tingkat_kelas($this->session->userdata('unitid'));
		$data['kelas'] = $this->master_model->combo_kelas($this->session->userdata('unitid'),$this->session->userdata('tahunajaran'),$data['value_tingkat']);
		// $data['kelas'] = $this->pelajaran_model->getKelas($this->session->userdata('unitid'));
		// $data['semester'] = $this->pelajaran_model->getSmt($this->session->userdata('unitid'));
		
		$data['url_filter'] = 'presensi_harian/index/act_filter';
		$data['content'] = $this->load->view('grid',$data,true);
		$this->load->view('main',$data);
	}
	
	function listpresensiharian_grid($id_sekolah, $id_tingkat='',$id_kelas='',$id_smt='',$tglpresensi='')
	{	
	
		//List of all fields that can be sortable. This is Optional.
		//This prevents that a user sorts by a column that we dont want him to access, or that doesnt exist, preventing errors.
		$valid_fields = array('TAHUN_AJARAN','TINGKAT','KELAS','SEMESTER','TANGGAL');
		
		$this->flexigrid->validate_post('TANGGAL','desc',$valid_fields);

		$records = $this->presensi_model->get_presensi_harian($id_sekolah, $id_tingkat,$id_kelas,$id_smt);
		
		// var_dump($records);
		$this->output->set_header($this->config->item('json_header'));
		$no = 0;
		/*
		 * Json build WITH json_encode. If you do not have this function please read
		 * http://flexigrid.eyeviewdesign.com/index.php/flexigrid/example#s3 to know how to use the alternative
		 */
		foreach ($records['records']->result() as $row)
		{
			$record_items[] = array($row->ID_SEK."#".$row->ID_TA."#".$row->ID_TINGKAT."#".$row->ID_KELAS."#".$row->ID_SMT."#".$row->TANGGAL,
			$no+1,
			'<div align="left">'.$row->NAMA_TA.'</div>',
			'<div align="left">'.$row->TINGKAT.'</div>',
			'<div align="left">'.$row->KELAS.'</div>',
			'<div align="left">'.$row->SEMESTER.'</div>',
			'<div align="left">'.xFormatDate($row->TANGGAL,'-','/').'</div>',
			'<a href=\''.site_url().'/presensi_harian/edit_presensiharian/'.$id_sekolah.'/'.$row->ID_TA.'/'.$row->ID_TINGKAT.'/'.$row->ID_KELAS.'/'.$row->ID_SMT.'/'.$row->TANGGAL.'/\'><img border=\'0\' src=\''.base_url().'images/main/28.png\'></a> 
			&nbsp;&nbsp;<a style=\'cursor:pointer\' title="Hapus Presensi Pada Tanggal ini." onclick=\'deleteabsen("'.$id_sekolah.'","'.$row->ID_TA.'","'.$row->ID_TINGKAT.'","'.$row->ID_KELAS.'","'.$row->ID_SMT.'","'.$row->TANGGAL.'")\'><img border=\'0\' src=\''.base_url().'images/delete.png\'></a>',
			// &nbsp;&nbsp;<a title="Hapus Presensi Pada Tanggal ini." href=\''.site_url().'/presensi_harian/delete_presensiharian/'.$id_sekolah.'/'.$row->ID_TA.'/'.$row->ID_TINGKAT.'/'.$row->ID_KELAS.'/'.$row->ID_SMT.'/'.$row->TANGGAL.'/\'><img border=\'0\' src=\''.base_url().'images/delete.png\'></a>',
			
			'<img title="Cetak Absensi format html" border=\'0\' src=\''.base_url().'images/main/print.png\' style=\'cursor:pointer\' onclick=\'go_cetak("'.$this->session->userdata('unitid').'","'.$this->session->userdata('tahunajaran').'","'.$id_tingkat.'","'.$id_kelas.'","'.$id_smt.'","'.$row->TANGGAL.'", "html")\'>
			&nbsp;&nbsp;<a title="Cetak Absensi format pdf" href=\''.site_url().'/presensi_harian/cetak_presensi/'.$id_tingkat.'/'.$id_kelas.'/'.$id_smt.'/pdf/'.$row->TANGGAL.'/\'><img border=\'0\' src=\''.base_url().'images/report/pdf.gif\'></a> 
			&nbsp;&nbsp;<a title="Cetak Absensi format excel" href=\''.site_url().'/presensi_harian/cetak_presensi/'.$id_tingkat.'/'.$id_kelas.'/'.$id_smt.'/xls/'.$row->TANGGAL.'/\'><img border=\'0\' src=\''.base_url().'images/report/xls.png\'></a> '
			);
			$no++;
		}
		//Print please
		if(isset($record_items))
				$this->output->set_output($this->flexigrid->json_build($records['record_count'],$record_items));
			else
				$this->output->set_output('{"page":"1","total":"0","rows":[]}');
	}
	
	function cek_validasi() {	
			// Setting Rules
			$this->form_validation->set_rules('tglpresensi', 'Tanggal Presensi', 'required');
			if($this->session->userdata('roleid')=='0') //diknas
				$this->form_validation->set_rules('nama_sekolah', 'Nama Sekolah', 'required');
			
			// Setting Error Message
			$this->form_validation->set_message('required', 'Kolom %s harus diisi!!');
			
			// Setting Delimiter
			$this->form_validation->set_error_delimiters('<li class="error">', '</li>');
			return $this->form_validation->run();
	}
	
	function cek_ph($id_sekolah, $id_ta, $tingkat, $kelas, $smt, $tglpresensi){
		$rs_cek = $this->presensi_model->validasi_ph($id_sekolah,$id_ta, $tingkat, $kelas, $smt, $tglpresensi)->row();
		return $rs_cek;
	}
	
	function input_presensiharian($id_sekolah,$id_tingkat='', $id_kelas='', $id_smt='')
    {
		$data['tahunajaran'] = $this->pelajaran_model->getTa($id_sekolah);
		// var_dump($_POST);
		if ($this->cek_validasi() == FALSE){
			$data['status'] = 'new';
			$data['r_tingkat'] = $this->pelajaran_model->getTingkat($id_sekolah);
			$data['r_kelas'] = $this->pelajaran_model->getKelas($id_sekolah);
			$data['r_semester'] = $this->pelajaran_model->getSmt($id_sekolah);
			$data['r_daftarsiswa'] = $this->presensi_model->get_siswa_kelas($id_sekolah, $data['tahunajaran']->row()->ID_TA, $id_tingkat, $id_kelas);
			$data['r_absensi'] = $this->presensi_model->get_presensi_kelas($id_sekolah, $data['tahunajaran']->row()->ID_TA, $id_tingkat, $id_kelas);
			// $data['errtglpresensi'] = $this->input->post('tglpresensi');
			$data['content'] = $this->load->view('form_presensi_harian',$data,true);
			$this->load->view('main',$data);
		}
		else{
			if($this->cek_ph($id_sekolah,$data['tahunajaran']->row()->ID_TA,$this->input->post('tingkat'),$this->input->post('kelas'),$this->input->post('semester'), xFormatDate($this->input->post('tglpresensi'),'/','-'))->jml > 0){ //sdh ada di database, reject
				$data['status'] = 'new';
				$data['r_tingkat'] = $this->pelajaran_model->getTingkat($id_sekolah);
				$data['r_kelas'] = $this->pelajaran_model->getKelas($id_sekolah);
				$data['r_semester'] = $this->pelajaran_model->getSmt($id_sekolah);
				$data['r_daftarsiswa'] = $this->presensi_model->get_siswa_kelas($id_sekolah, $data['tahunajaran']->row()->ID_TA, $id_tingkat, $id_kelas);
				$data['r_absensi'] = $this->presensi_model->get_presensi_kelas($id_sekolah, $data['tahunajaran']->row()->ID_TA, $id_tingkat, $id_kelas);
				$data['errtglpresensi'] = xFormatDate($this->input->post('tglpresensi'),'/','-');
			
				$data['value'] = $this->input->post();
				$data['err_msg'] = 'Data Presensi pada tanggal ini telah ada dalam database.';
				$data['content'] = $this->load->view('form_presensi_harian',$data,true);
				$this->load->view('main',$data);
			}else{
				// $data['tahunajaran'] = $this->pelajaran_model->getTa($id_sekolah);
				$this->insert_presensiharian($id_sekolah,$data['tahunajaran']->row()->ID_TA);
			}
		}            
    }
	
	function insert_presensiharian($id_sekolah,$id_ta){
		$siswa_kelas = $this->presensi_model->get_siswa_kelas($id_sekolah, $id_ta, $this->input->post('tingkat'), $this->input->post('kelas'));
		$hasil = 0;
		foreach($siswa_kelas->result() as $row){
			$data = array(
				'TAHUN_AJARAN'			=> $id_ta,
				'ID_SEKOLAH'			=> $id_sekolah,
				'ID_TINGKAT'			=> $this->input->post('tingkat'),	
				'ID_KELAS'				=> $this->input->post('kelas'),	
				'ID_SEMESTER'			=> $this->session->userdata('semester'),	
				'TANGGAL'				=> xFormatDate($this->input->post('tglpresensi'),'/','-'),	
				'NISN'		 			=> $row->NISN,
				'JENIS_KEHADIRAN'		=> $this->input->post('jenis_kehadiran'.$row->NISN),
				'KETERANGAN' 			=> $this->input->post('keterangan'.$row->NISN)
			);
			$this->presensi_model->insert_presensiharian($data);
			$hasil = 1;
		}
		if($hasil == 1)
			$this->session->set_flashdata('suc_msg', 'Data berhasil disimpan.');
		else $this->session->set_flashdata('suc_msg', 'Maaf, tidak terdapat mahasiswa pada kelas ini.');
		redirect('presensi_harian'); 
	}
	
	function edit_presensiharian($id_sekolah,$id_ta,$id_tingkat, $id_kelas, $id_semester, $tglpresensi)
    {	
		$data['tahunajaran'] = $this->pelajaran_model->getTa($id_sekolah);
 		if ($this->cek_validasi() == FALSE){
			$data['status'] = 'edit';
			$data['r_tingkat'] = $this->pelajaran_model->getTingkat($id_sekolah);
			$data['r_kelas'] = $this->pelajaran_model->getKelas($id_sekolah);
			$data['r_semester'] = $this->pelajaran_model->getSmt($id_sekolah);
			$data['r_daftarsiswa'] = $this->presensi_model->get_siswa_kelas($id_sekolah, $id_ta, $id_tingkat, $id_kelas);
			$data['r_absensi'] = $this->presensi_model->get_presensi_kelas($id_sekolah, $id_ta, $id_tingkat, $id_kelas);
			
			$data['rs_presensi'] = $this->presensi_model->get_presensiharianID($id_sekolah, $id_ta, $id_tingkat, $id_kelas, $id_semester, $tglpresensi);
			$data['content'] = $this->load->view('form_presensi_harian',$data,true);
			$this->load->view('main',$data);
		}
		else{
			if($this->cek_ph($id_sekolah,$id_ta,$this->input->post('tingkat'),$this->input->post('kelas'),$this->input->post('semester'), xFormatDate($this->input->post('tglpresensi'),'/','-'))->jml > 0 and $tglpresensi !=  xFormatDate($this->input->post('tglpresensi'),'/','-')){ //sdh ada di database, reject
				$data['status'] = 'edit';
				$data['r_tingkat'] = $this->pelajaran_model->getTingkat($id_sekolah);
				$data['r_kelas'] = $this->pelajaran_model->getKelas($id_sekolah);
				$data['r_semester'] = $this->pelajaran_model->getSmt($id_sekolah);
				$data['r_daftarsiswa'] = $this->presensi_model->get_siswa_kelas($id_sekolah, $id_ta, $id_tingkat, $id_kelas);
				$data['r_absensi'] = $this->presensi_model->get_presensi_kelas($id_sekolah, $id_ta, $id_tingkat, $id_kelas);
				$data['errtglpresensi'] = xFormatDate($this->input->post('tglpresensi'),'/','-');
			
				$data['rs_presensi'] = $this->presensi_model->get_presensiharianID($id_sekolah, $id_ta, $id_tingkat, $id_kelas, $id_semester, $tglpresensi);
				$data['err_msg'] = 'Presensi pada tanggal tersebut telah ada dalam database.';
				$data['content'] = $this->load->view('form_presensi_harian',$data,true);
				$this->load->view('main',$data);
			}else
				$this->update_presensiharian($id_sekolah,$id_ta,$id_tingkat, $id_kelas, $id_semester, $tglpresensi);
		}            
    }
	
	function update_presensiharian($id_sekolah,$id_ta,$id_tingkat, $id_kelas, $id_semester, $tglpresensi){
		$this->presensi_model->delete_presensiharian($id_sekolah,$id_ta,$id_tingkat, $id_kelas, $id_semester, $tglpresensi);
		$siswa_kelas = $this->presensi_model->get_siswa_kelas($id_sekolah, $id_ta, $this->input->post('tingkat'), $this->input->post('kelas'));
		foreach($siswa_kelas->result() as $row){
			$data = array(
				'TAHUN_AJARAN'			=> $id_ta,
				'ID_SEKOLAH'			=> $id_sekolah,
				'ID_TINGKAT'			=> $this->input->post('tingkat'),	
				'ID_KELAS'				=> $this->input->post('kelas'),	
				'ID_SEMESTER'			=> $this->session->userdata('semester'),	
				'TANGGAL'				=> xFormatDate($this->input->post('tglpresensi'),'/','-'),	
				'NISN'		 			=> $row->NISN,
				'JENIS_KEHADIRAN'		=> $this->input->post('jenis_kehadiran'.$row->NISN),
				'KETERANGAN' 			=> $this->input->post('keterangan'.$row->NISN)
			);
			$this->presensi_model->insert_presensiharian($data);
		}
		$this->session->set_flashdata('suc_msg', 'Data berhasil diupdate.');
		redirect('presensi_harian'); 
	}
	
	//Delete
	function delete_presensiharian($id_sekolah, $id_ta,$id_tingkat,$id_kelas,$id_semester,$tglpresensi)
	{
		// echo "<script> var del=confirm('Apakah Anda yakin akan menghapus Semua Nilai Pada Mata Pelajaran Ini ?'); </script> ";
		$this->presensi_model->delete_presensiharian($id_sekolah, $id_ta,$id_tingkat,$id_kelas,$id_semester,$tglpresensi);
		$this->session->set_flashdata('suc_msg', 'Data berhasil dihapus.');
		redirect('presensi_harian');
	}
	
	function cetak_presensi($id_tingkat, $id_kelas, $id_semester, $type='', $tgl_presensi='' ){
		$this->load->helper('to_pdf');
		$this->load->helper('file');
		
		// $data['nisn'] = $nisn;
		// $data['nama'] = $this->siswa_model->get_siswaID($nisn)->row()->NAMA_LENGKAP;
		$data['tahunajaran'] = $this->pelajaran_model->getTa($this->session->userdata('unitid'))->row()->TAHUN_AJARAN;
		$data['r_tingkat'] = $this->pelajaran_model->getTingkat($this->session->userdata('unitid'),$id_tingkat)->row()->TINGKAT;
		$data['r_kelas'] = $this->pelajaran_model->getKelas($this->session->userdata('unitid'),$id_kelas)->row()->KELAS;
		$data['r_semester'] = $this->pelajaran_model->getSmt($this->session->userdata('unitid'),$id_semester)->row()->SEMESTER;
		$data['r_walikelas'] = $this->presensi_model->getWaliKelas($id_tingkat, $id_kelas)->row();
		$data['r_daftarsiswa'] = $this->presensi_model->get_siswa_kelas($this->session->userdata('unitid'), $this->session->userdata('tahunajaran'), $id_tingkat, $id_kelas);
		$data['rs_presensi'] = $this->presensi_model->get_presensiharianID($this->session->userdata('unitid'), $this->session->userdata('tahunajaran'), $id_tingkat, $id_kelas, $id_semester, $tgl_presensi);
		$data['tglpresensi'] = $tgl_presensi;
		
		if($type == 'pdf'){
			$filename="absen_".$data['r_kelas']."_".$tgl_presensi;
			$data['type'] = 'pdf';
			$logo_cetak = $this->konfigurasi_model->get_header()->row();
			$nama_ins = $this->konfigurasi_model->get_logo()->row();
			$data['url_logo'] = $logo_cetak;
			$data['instansi'] = $nama_ins->ALAMAT_SEKOLAH_1;
			$html = $this->load->view('form_cetak_presensi',$data,TRUE);
			pdf_create($html, $filename);
		}
		else if($type == 'xls'){
			$data['filename']="absen_".$data['r_kelas']."_".$tgl_presensi;
			$data['type'] = 'xls';
			$logo_cetak = $this->konfigurasi_model->get_header()->row();
			$nama_ins = $this->konfigurasi_model->get_logo()->row();
			$data['url_logo'] = $logo_cetak;
			$data['instansi'] = $nama_ins->ALAMAT_SEKOLAH_1;
			$this->load->view('form_cetak_presensi',$data);
		}
		else if($type == 'html'){
			$data['type'] = 'html';
			$logo_cetak = $this->konfigurasi_model->get_header()->row();
			$nama_ins = $this->konfigurasi_model->get_logo()->row();
			$data['url_logo'] = $logo_cetak;
			$data['instansi'] = $nama_ins->ALAMAT_SEKOLAH_1;
			$this->load->view('form_cetak_presensi_html',$data);
		}else{
			$data['type'] = 'kosong';
			$logo_cetak = $this->konfigurasi_model->get_header()->row();
			$nama_ins = $this->konfigurasi_model->get_logo()->row();
			$data['url_logo'] = $logo_cetak;
			$data['instansi'] = $nama_ins->ALAMAT_SEKOLAH_1;
			$this->load->view('form_cetak_presensi',$data);
		}
	}	

}
?>
